# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-gdstk
pkgver=0.9.42
_commit=41f72281ca4ec9f1727cde702b88cc780ccdb27a
pkgrel=1
pkgdesc="Python module for creating GDSII stream files, usually CAD layouts"
url="https://github.com/heitzmann/gdstk"
license=('custom:BSL')
arch=('loong64' 'x86_64')
depends=('python-numpy')
makedepends=('git' 'python-setuptools' 'cmake')
checkdepends=('python-pytest-runner')
source=("git+https://github.com/heitzmann/gdstk.git#commit=$_commit")
sha512sums=('SKIP')

prepare() {
  cd gdstk
  # Upstream wants to test CI :/
  sed -i 's/oldest-supported-numpy/numpy/' setup.py
}

build() {
  cd gdstk
  python setup.py build
}

check() {
  cd gdstk
  python setup.py pytest
}

package() {
  cd gdstk
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
